<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>Signin Template for Bootstrap</title>
    <!-- Bootstrap core CSS -->
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link th:href="@{/css/signin.css}" rel="stylesheet">
</head>

<body class="text-center">
<!--<form class="form-signin" th:action="@{/login}">-->
<form class="form-signin" action="" id = "loglog">
    <img class="mb-4" th:src="@{/img/bootstrap-solid.svg}" alt="" width="72" height="72">
    <h1 class="h3 mb-3 font-weight-normal" th:text="#{login.tip}">Please sign in</h1>
<!--    如果msg为空则不显示-->
    <p style="color: red" th:text="${msg}" th:if="${not #strings.isEmpty(msg)}"></p>
    <label class="sr-only" th:text="#{login.userid}">Userid</label>
    <input type="text" name="sId" class="form-control" th:placeholder="#{login.userid}" required="" autofocus="">
<!--    <input type="text" name="username" class="form-control" placeholder="Username" required="" autofocus="">-->
    <label class="sr-only" th:text="#{login.password}">Password</label>
    <input type="password" name="sPassword" class="form-control" th:placeholder="#{login.password}" required="">
<!--    <input type="password" name="password" class="form-control" placeholder="Password" required="">-->
    <select class="form-control form-control-lg" name="duties" id="duties">
        <option value="总经理">总经理</option>
        <option value="经理">经理</option>
        <option value="组长" selected="selected">组长</option>
        <option value="财务">财务</option>
        <option value="出纳">出纳</option>
    </select>
    <div class="checkbox mb-3">
        <label>
<!--            <input type="checkbox" th:text="#{login.remember}">-->
            <input type="checkbox" value="remember-me"th:text="#{login.remember}">
        </label>
    </div>
<!--    <button class="btn btn-lg btn-primary btn-block" type="submit" th:text="#{login.btn}">Sign in</button>-->
    <button class="btn btn-lg btn-primary btn-block" type="submit" th:text="#{login.tip}" onclick="signIn()">Sign in</button>
    <p class="mt-5 mb-3 text-muted">©2023-2024</p>

    <a class="btn btn-sm" th:href="@{/index.html(l='zh_CN')}">中文</a>
    <a class="btn btn-sm" th:href="@{/index.html(l='en_US')}">English</a>
</form>
<script type="text/javascript" th:src="@{/js/jquery-3.7.1.min.js}"></script>
<script type="text/javascript" th:src="@{/js/popper.min.js}"></script>
<script type="text/javascript" th:src="@{/js/bootstrap.min.js}"></script>

<!-- Icons -->
<script type="text/javascript" th:src="@{/js/feather.min.js}"></script>
<script>
    function signIn(){
        var contentSId = $("[name=sId]").val();
        var contentSPassword = $("[name=sPassword]").val();
        var contentStaff = $('#duties option:selected').val();

        if(contentStaff=='经理'){
            url = '/manager/user/login'
            $("#loglog").attr("action",url)
        }else if (contentStaff == '财务'){
            url = '/finance/user/login'
            $("#loglog").attr("action",url)
        }else {
            url = '/staff/user/login'
            $("#loglog").attr("action",url)
        }

    }
</script>
</body>

</html>